package com.xxxx.manager.controller;

import com.xxxx.common.result.FileResult;
import com.xxxx.manager.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("/fileUpload")
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 新增分类模块中图片上传
     * 注意前台传入的MultipartFile需要转换为File类型
     * 工具类在QiniuUtils中
     * @param file
     * @return
     * @throws Exception
     */
    @PostMapping("/save")
    @ResponseBody
    public FileResult fileUpload(MultipartFile file) throws Exception {
        return fileService.fileUpload(file);
    }



}
